Platform Explorer / Nuxeo Platform 5.8

Contribution studio.extensions.nuxeo-jenkins-report--chains

This contribution is part of XML component studio.extensions.nuxeo-jenkins-report inside nuxeo-jenkins-report-3.2.0.jar

Extension Point

Extension point chains of component OperationServiceComponent.

Contributed Items

  • <chain id="JenkinsReportCreation">
          <operation id="Context.FetchDocument"/>
          <operation id="Document.SetProperty">
            <param name="value" type="serializable">expr:CurrentUser.name</param>
            <param name="xpath" type="string">jenkinsreport:reporter</param>
            <param name="save" type="boolean">false</param>
          </operation>
          <operation id="Document.SetProperty">
            <param name="value" type="serializable">expr:@{CurrentDate.year}/@{CurrentDate.format("MM")}/@{CurrentDate.format("dd")}</param>
            <param name="xpath" type="string">dc:title</param>
            <param name="save" type="boolean">false</param>
          </operation>
          <operation id="Document.SetProperty">
            <param name="value" type="serializable">expr:CurrentDate.calendar</param>
            <param name="xpath" type="string">jenkinsreport:report_date</param>
            <param name="save" type="boolean">false</param>
          </operation>
          <operation id="Document.SetProperty">
            <param name="value" type="serializable">0</param>
            <param name="xpath" type="string">jenkinsreport:number_failed</param>
            <param name="save" type="boolean">false</param>
          </operation>
          <operation id="Document.SetProperty">
            <param name="value" type="serializable">0</param>
            <param name="xpath" type="string">jenkinsreport:previous_number_failed</param>
            <param name="save" type="boolean">false</param>
          </operation>
          <operation id="Document.SetProperty">
            <param name="value" type="serializable">0</param>
            <param name="xpath" type="string">jenkinsreport:previous_number_unclaimed</param>
            <param name="save" type="boolean">false</param>
          </operation>
        </chain>
  • <chain id="JenkinsReportModified">
          <operation id="Context.FetchDocument"/>
          <operation id="Context.RunScript">
            <param name="script" type="string">var jobs = Document["jenkinsreport:unstable_jobs"];
    nbUnclaimed = 0;
    foreach (job : jobs) {
      if (job["claimer"] == empty and job["type"] != "SUCCESS" and job["updated_type"] != "SUCCESS") {
        nbUnclaimed ++;
      }
    }
    Document["jenkinsreport:number_unclaimed"] = nbUnclaimed;</param>
          </operation>
          <operation id="Context.RunScript">
            <param name="script" type="string">var jobs = Document["jenkinsreport:unstable_jobs"];
    nbFailing = 0;
    foreach (job : jobs) {
      if (job["type"] != "SUCCESS" and job["updated_type"] != "SUCCESS") {
        nbFailing ++;
      }
    }
    Document["jenkinsreport:number_failed"] = nbFailing;</param>
          </operation>
          <operation id="Context.RunScript">
            <param name="script" type="string">var jobs = Document["jenkinsreport:unstable_jobs"];
    nb = 0;
    foreach (job : jobs) {
      if (job["updated_type"] == "SUCCESS") {
        nb --;
      } else if (job["newly_failing"] == true) {
        nb ++;
      }
    }
    Document["jenkinsreport:report_trend"] = nb;</param>
          </operation>
        </chain>
  • <chain id="JenkinsReportSendMail">
          <operation id="Context.FetchDocument"/>
          <operation id="Document.Push"/>
          <operation id="Document.GetParent"/>
          <operation id="Context.SetVar">
            <param name="name" type="string">jenkins_report_email</param>
            <param name="value" type="object">expr:Document.getProperty("jenkinsreports:report_email")</param>
          </operation>
          <operation id="Context.SetVar">
            <param name="name" type="string">jenkins_url</param>
            <param name="value" type="object">expr:Document.getProperty("jenkinsreports:view_url")</param>
          </operation>
          <operation id="Document.Pull"/>
          <operation id="Notification.SendMail">
            <param name="from" type="string">expr:CurrentUser.email</param>
            <param name="message" type="string">template:JenkinsReportSendMail</param>
            <param name="subject" type="string">expr:Jenkins Report - @{Document.title}</param>
            <param name="to" type="stringlist">expr:Context["jenkins_report_email"]</param>
            <param name="HTML" type="boolean">true</param>
            <param name="rollbackOnError" type="boolean">true</param>
            <param name="viewId" type="string">view_documents</param>
          </operation>
          <operation id="Seam.AddInfoMessage">
            <param name="message" type="string">Email sent</param>
          </operation>
        </chain>
  • <chain id="JenkinsReportsContainerCreation">
          <operation id="Context.FetchDocument"/>
          <operation id="Document.SetProperty">
            <param name="value" type="serializable">http://qa.nuxeo.org/jenkins/view/Dashboard/</param>
            <param name="xpath" type="string">jenkinsreports:view_url</param>
            <param name="save" type="boolean">false</param>
          </operation>
          <operation id="Document.SetProperty">
            <param name="value" type="serializable">http://qa.nuxeo.org/jenkins/claims/</param>
            <param name="xpath" type="string">jenkinsreports:claim_url</param>
            <param name="save" type="boolean">false</param>
          </operation>
        </chain>

XML Source

<extension point="chains" target="org.nuxeo.ecm.core.operation.OperationServiceComponent">
    <chain id="JenkinsReportCreation">
      <operation id="Context.FetchDocument"/>
      <operation id="Document.SetProperty">
        <param name="value" type="serializable">expr:CurrentUser.name</param>
        <param name="xpath" type="string">jenkinsreport:reporter</param>
        <param name="save" type="boolean">false</param>
      </operation>
      <operation id="Document.SetProperty">
        <param name="value" type="serializable">expr:@{CurrentDate.year}/@{CurrentDate.format("MM")}/@{CurrentDate.format("dd")}</param>
        <param name="xpath" type="string">dc:title</param>
        <param name="save" type="boolean">false</param>
      </operation>
      <operation id="Document.SetProperty">
        <param name="value" type="serializable">expr:CurrentDate.calendar</param>
        <param name="xpath" type="string">jenkinsreport:report_date</param>
        <param name="save" type="boolean">false</param>
      </operation>
      <operation id="Document.SetProperty">
        <param name="value" type="serializable">0</param>
        <param name="xpath" type="string">jenkinsreport:number_failed</param>
        <param name="save" type="boolean">false</param>
      </operation>
      <operation id="Document.SetProperty">
        <param name="value" type="serializable">0</param>
        <param name="xpath" type="string">jenkinsreport:previous_number_failed</param>
        <param name="save" type="boolean">false</param>
      </operation>
      <operation id="Document.SetProperty">
        <param name="value" type="serializable">0</param>
        <param name="xpath" type="string">jenkinsreport:previous_number_unclaimed</param>
        <param name="save" type="boolean">false</param>
      </operation>
    </chain>
    <chain id="JenkinsReportModified">
      <operation id="Context.FetchDocument"/>
      <operation id="Context.RunScript">
        <param name="script" type="string">var jobs = Document["jenkinsreport:unstable_jobs"];
nbUnclaimed = 0;
foreach (job : jobs) {
  if (job["claimer"] == empty and job["type"] != "SUCCESS" and job["updated_type"] != "SUCCESS") {
    nbUnclaimed ++;
  }
}
Document["jenkinsreport:number_unclaimed"] = nbUnclaimed;</param>
      </operation>
      <operation id="Context.RunScript">
        <param name="script" type="string">var jobs = Document["jenkinsreport:unstable_jobs"];
nbFailing = 0;
foreach (job : jobs) {
  if (job["type"] != "SUCCESS" and job["updated_type"] != "SUCCESS") {
    nbFailing ++;
  }
}
Document["jenkinsreport:number_failed"] = nbFailing;</param>
      </operation>
      <operation id="Context.RunScript">
        <param name="script" type="string">var jobs = Document["jenkinsreport:unstable_jobs"];
nb = 0;
foreach (job : jobs) {
  if (job["updated_type"] == "SUCCESS") {
    nb --;
  } else if (job["newly_failing"] == true) {
    nb ++;
  }
}
Document["jenkinsreport:report_trend"] = nb;</param>
      </operation>
    </chain>
    <chain id="JenkinsReportSendMail">
      <operation id="Context.FetchDocument"/>
      <operation id="Document.Push"/>
      <operation id="Document.GetParent"/>
      <operation id="Context.SetVar">
        <param name="name" type="string">jenkins_report_email</param>
        <param name="value" type="object">expr:Document.getProperty("jenkinsreports:report_email")</param>
      </operation>
      <operation id="Context.SetVar">
        <param name="name" type="string">jenkins_url</param>
        <param name="value" type="object">expr:Document.getProperty("jenkinsreports:view_url")</param>
      </operation>
      <operation id="Document.Pull"/>
      <operation id="Notification.SendMail">
        <param name="from" type="string">expr:CurrentUser.email</param>
        <param name="message" type="string">template:JenkinsReportSendMail</param>
        <param name="subject" type="string">expr:Jenkins Report - @{Document.title}</param>
        <param name="to" type="stringlist">expr:Context["jenkins_report_email"]</param>
        <param name="HTML" type="boolean">true</param>
        <param name="rollbackOnError" type="boolean">true</param>
        <param name="viewId" type="string">view_documents</param>
      </operation>
      <operation id="Seam.AddInfoMessage">
        <param name="message" type="string">Email sent</param>
      </operation>
    </chain>
    <chain id="JenkinsReportsContainerCreation">
      <operation id="Context.FetchDocument"/>
      <operation id="Document.SetProperty">
        <param name="value" type="serializable">http://qa.nuxeo.org/jenkins/view/Dashboard/</param>
        <param name="xpath" type="string">jenkinsreports:view_url</param>
        <param name="save" type="boolean">false</param>
      </operation>
      <operation id="Document.SetProperty">
        <param name="value" type="serializable">http://qa.nuxeo.org/jenkins/claims/</param>
        <param name="xpath" type="string">jenkinsreports:claim_url</param>
        <param name="save" type="boolean">false</param>
      </operation>
    </chain>
  </extension>